import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import '../../../config/route/bt_app_router.gr.dart';
import '../../../data/stats/bt_log_pages.dart';
import '../../../data/stats/bt_log_pv_manger.dart';
import '../../utils/bt_app_bar_utils.dart';
import '../models/bt_about_model.dart';

@RoutePage(name: "aboutRoute")
class BtAboutScreen extends StatelessWidget {
  const BtAboutScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return ChangeNotifierProvider(
      create: (context) => BtAboutModel(),
      child: Consumer<BtAboutModel>(builder: (context, model, _) {
        return Scaffold(
          backgroundColor: Colors.white,
          appBar: appBar(context, 'About', null),
          body: Container(
            padding: const EdgeInsets.only(left: 32, right: 32),
            child: Column(
              children: [
                Padding(
                  padding: const EdgeInsets.only(top: 52, bottom: 52),
                  child: Center(
                    child: Image.asset(
                      'assets/images/bt_logo_large.png',
                      width: 141,
                      height: 22,
                    ),
                  ),
                ),
                Container(
                  padding: const EdgeInsets.only(left: 20, right: 25, top: 12, bottom: 12),
                  decoration: BoxDecoration(
                    color: const Color(0xFFF7F8FA),
                    borderRadius: BorderRadius.circular(12),
                  ),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      const Text("Version", style: TextStyle(fontSize: 16, color: Color(0xFF404040))),
                      Text(model.versionName, style: const TextStyle(fontSize: 12, color: Color(0x70000000)))
                    ],
                  ),
                ),
                const SizedBox(height: 20),
                InkWell(
                  child: Container(
                    width: double.infinity,
                    padding: const EdgeInsets.only(left: 20, right: 25, top: 12, bottom: 12),
                    decoration: BoxDecoration(
                      color: const Color(0xFFF7F8FA),
                      borderRadius: BorderRadius.circular(12),
                    ),
                    child: const Text("Terms and Conditions",
                        style: TextStyle(fontSize: 16, color: Color(0xFF404040))),
                  ),
                  onTap: () {
                    BtLogPvManger.stat(page: BtLogPages.terms);
                    context.router.navigate(WebViewRoute(
                        title: 'Terms and Conditions', webUrl: 'https://h5.heeru.xyz/termConditions.html'));
                  },
                ),
                const SizedBox(height: 20),
                InkWell(
                  child: Container(
                    width: double.infinity,
                    padding: const EdgeInsets.only(left: 20, right: 25, top: 12, bottom: 12),
                    decoration: BoxDecoration(
                      color: const Color(0xFFF7F8FA),
                      borderRadius: BorderRadius.circular(12),
                    ),
                    child: const Text("Privacy Policy",
                        style: TextStyle(fontSize: 16, color: Color(0xFF404040))),
                  ),
                  onTap: () {
                    BtLogPvManger.stat(page: BtLogPages.privacy);
                    context.router.navigate(WebViewRoute(
                        title: 'Privacy Policy', webUrl: 'https://h5.heeru.xyz/privacyPolicy.html'));
                  },
                ),
              ],
            ),
          ),
        );
      }),
    );
  }
}
